from typing import TYPE_CHECKING

from app.db.base_class import Base
from sqlalchemy import Boolean, Column, Integer, String, text, TIMESTAMP, BigInteger, Numeric, DECIMAL


class Position(Base):
    __tablename__ = 'tb_position'

    id = Column(BigInteger, primary_key=True)
    userId = Column('user_id', BigInteger)
    instrumentId = Column('instrument_Id', Integer, nullable=False)
    cost = Column(DECIMAL(16, 10))
    num = Column(DECIMAL(16, 10))
    startDate = Column('start_date', TIMESTAMP)
    endDate = Column('end_date', TIMESTAMP)
    state = Column(String(2))
    createdDate = Column('created_date', TIMESTAMP, server_default=text('CURRENT_TIMESTAMP'))
    updatedDate = Column('updated_date', TIMESTAMP,
                         server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'))


